<template>
  <div>
    <home-hander :city="city"></home-hander>
    <home-swiper :list="swiperList"></home-swiper>
    <home-icon :list="iconList"></home-icon>
    <home-recomment :list="recommentList"></home-recomment>
    <home-weekend-go :list="weekendGoList"></home-weekend-go>
  </div>
</template>

<script>
import HomeHander from './components/Hander'
import HomeSwiper from './components/Swiper'
import HomeIcon from './components/Icon'
import HomeRecomment from './components/Recomment'
import HomeWeekendGo from './components/WeekendGo'
import axios from 'axios'
export default {
  name: 'Home',
  components: {
    HomeHander,
    HomeSwiper,
    HomeIcon,
    HomeRecomment,
    HomeWeekendGo
  },
  data () {
    return {
      city: '',
      recommentList: [],
      weekendGoList: [],
      swiperList: [],
      iconList: []
    }
  },
  methods: {
    getHomeInfo () {
      axios.get('api/index.json').then(this.getHomeInfoSucc)
    },
    getHomeInfoSucc (res) {
      res = res.data
      if (res.ret && res.data) {
        const data = res.data
        this.city = data.city
        this.recommentList = data.recommendList
        this.weekendGoList = data.weekendList
        this.swiperList = data.swiperList
        this.iconList = data.iconList
      }
    }
  },
  mounted () {
    this.getHomeInfo()
  }
}
</script>

<style></style>
